﻿@model EditForumTopicModel
@using Nop.Core.Domain.Forums;
@using Nop.Web.Models.Boards;

@Html.Action("ForumBreadcrumb", new { forumId = Model.ForumId, forumTopicId = Model.Id })
<div class="page forum-edit-page">
    <div class="page-title">
        @if (Model.IsEdit)
        {
            <h1>@T("Forum.EditTopic")</h1>
        }
        else
        {
            <h1>@T("Forum.NewTopic")</h1>
        }
    </div>
    <div class="page-body">
        @using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()
            var validationSummary = Html.ValidationSummary(true);
            if (!MvcHtmlString.IsNullOrEmpty(validationSummary))
            {
                <div class="message-error">@validationSummary</div> 
            }
            @Html.HiddenFor(model => model.Id)
            @Html.HiddenFor(model => model.ForumId)
            <div class="fieldset">
                <div class="form-fields">
                    <div class="inputs">
                        <label>@T("Forum.ForumName"):</label>
                        <strong>@Model.ForumName</strong>
                    </div>
                    <div class="inputs">
                        <label>@T("Forum.TopicTitle"):</label>
                        @Html.TextBoxFor(model => model.Subject, new { @class = "forum-topic-title-text" })
                        @Html.ValidationMessageFor(model => model.Subject)
                    </div>
                    <div class="inputs">
                        @if (Model.ForumEditor == EditorType.BBCodeEditor)
                        {
                            @Html.BBCodeEditor("Text")
                        }
                        @Html.TextAreaFor(model => model.Text, new { @class = "forum-post-text", TextMode = "MultiLine" })
                        @Html.ValidationMessageFor(model => model.Text)
                    </div>
                    @if (Model.IsCustomerAllowedToSetTopicPriority)
                    {
                        <div class="inputs">
                            <label>@T("Forum.Priority"):</label>
                            @Html.DropDownList("TopicTypeId", new SelectList(Model.TopicPriorities, "Value", "Text", Model.TopicTypeId))
                        </div>
                    }
                    @if (Model.IsCustomerAllowedToSubscribe)
                    {
                        <div class="inputs reversed">
                            @Html.EditorFor(model => model.Subscribed)
                            <label>@T("Forum.NotifyWhenSomeonePostsInThisTopic")</label>
                        </div>
                    }
                </div>
            </div>
            <div class="buttons">
                <input type="submit" value="@T("Forum.Submit")" class="button-1 submit-topic-button" />
                <input type="button" class="button-2 cancel-topic-button" value="@T("Forum.Cancel")" onclick="setLocation('@Url.RouteUrl("ForumSlug", new { id = Model.ForumId, slug = Model.ForumSeName })')" />
            </div>
        }
    </div>
</div>

